import request from "@/utils/request";

// 获取物料分类列表
export function getMaterialCategoryList() {
	return request({
		url: "/operation/web/operationMaterialCatalogCategory/list",
		method: "get",
	});
}

// 新增物料分类
export function addMaterialCategory(data) {
	return request({
		url: "/operation/web/operationMaterialCatalogCategory",
		method: "post",
		data,
	});
}

// 修改物料分类
export function updateMaterialCategory(data) {
	return request({
		url: "/operation/web/operationMaterialCatalogCategory",
		method: "put",
		data,
	});
}

// 删除物料分类
export function deleteMaterialCategory(ids) {
	return request({
		url: `/operation/web/operationMaterialCatalogCategory/${ids}`,
		method: "delete",
	});
}

// 获取应用场景下拉列表
export function getApplicationSceneList() {
	return request({
		url: "/operation/web/operationMaterialCatalog/applicationScene",
		method: "get",
	});
}

// 查询物料名录列表
export function getMaterialCatalogList(params) {
	return request({
		url: "/operation/web/operationMaterialCatalog/list",
		method: "get",
		params,
	});
}

// 获取物料名录详细信息
export function getMaterialCatalogDetail(id) {
	return request({
		url: `/operation/web/operationMaterialCatalog/${id}`,
		method: "get",
	});
}

// 新增物料名录
export function addMaterialCatalog(data) {
	return request({
		url: "/operation/web/operationMaterialCatalog",
		method: "post",
		data,
	});
}

// 修改物料名录
export function updateMaterialCatalog(data) {
	return request({
		url: "/operation/web/operationMaterialCatalog",
		method: "put",
		data,
	});
}

// 删除物料名录
export function deleteMaterialCatalog(ids) {
	return request({
		url: `/operation/web/operationMaterialCatalog/${ids}`,
		method: "delete",
	});
}

// 导出物料名录
export function exportMaterialCatalog(params) {
	return request({
		url: "/operation/web/operationMaterialCatalog/export",
		method: "get",
		params,
		responseType: "blob",
	});
}

// 获取设备状态占比统计
export function getRatioByStatus() {
	return request({
		url: "/operation/web/operationMaterialCatalog/getRatioByStatus",
		method: "get",
	});
}

// 统计各设备类型的数量
export function getCountByCategoryType() {
	return request({
		url: "/operation/web/operationMaterialCatalog/getCountByCategoryType",
		method: "get",
	});
}
